<%@ page language="java" import="cn.ac.iscas.bean.patent.PatentPicture,cn.ac.iscas.bean.patent.Patent" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>   
  <head>  
    <title>录入专利</title> 
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<link rel="stylesheet" href="../../css/vip.css" type="text/css">
    <script language=JavaScript src="../../js/FoshanRen.js"></script>
    <script language="javascript" type="text/javascript" src="../../js/My97DatePicker/WdatePicker.js">
    <script type="text/javascript" src="../../js/showNewDiv.js"></script>
    <link rel="stylesheet" type="text/css" href="../../js/extjs/resources/css/ext-all.css"/>
   <script type="text/javascript" charset="utf-8" src="../../js/extjs/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../js/extjs/ext-all.js"></script>
<script type="text/javascript"charset="utf-8">
     Ext.onReady(function(){
     var proxy = new Ext.data.HttpProxy({url: "/otcrms/admin/paper/projectBindAction_showProjct.action"});
     var City = Ext.data.Record.create([
     {name: "projectId", type: "int", mapping: "projectId"},
     {name: "name", type: "string", mapping: "name"}
      ]);
     var reader = new Ext.data.JsonReader({
     totalProperty: "totalProperty", //总记录数
      root: "root" //所有的数据（json对象数组）
     }, City);
     var store = new Ext.data.Store({
     proxy: proxy,  
     reader: reader
     });
     var combo = new Ext.form.ComboBox({
     store: store,
     emptyText: "项目编号：",
     mode: "remote",
     pageSize: 7,
     triggerAction: "all",
     displayField: "name",
     valueField: "projectId",
     hiddenName: "project.id",
     renderTo: "project",
     readOnly: true,
     listWidth: 700
     });
      })
</script>
    <script language="javascript">
   function addPicture()
   {   
        var tr = document.createElement('tr');
        tr.setAttribute("bgcolor", "f5f5f5");
        var td1 = document.createElement('td');
        td1.setAttribute("width", "25%");
        var td2 = document.createElement('td');
        td2.setAttribute("width", "75%");
        var div = document.createElement('div');
       
        var uploadHTML = document.createElement('input');
        uploadHTML.setAttribute("type","file");
        uploadHTML.setAttribute("name","uploadPicture");
        var last = document.getElementById("last");
        var tables = last.parentNode;
      
        tr.appendChild(td1);
        td2.appendChild(uploadHTML);
        tr.appendChild(td2);
        tables.insertBefore(tr,last);
        var button = document.createElement("input");
        button.type = "button";
	    button.value = "删 除"
	    td2.appendChild(button);
        button.onclick = function()
	    {
		tables.removeChild(tr);
	   }
    }  
    
 function len(s){//获取字符串的字节长度
  return s.length+(s.match(/[^\x00-\xff]/g) ||"").length;//加上匹配到的全角字符长度
}
String.prototype.trim=function(){
return this.replace(/(^\s*)|(\s*$)/g,"");
}
function check(){
var reg=/^\d+$/;//判断是非负整数的正则表达式
var LEN400=400,LEN40=40,LEN20=20;
var f,patentName,acceptNo,patentNo,patentee,applyDate,primaryReviewDate,publicDate,certificateDate;
patentName=document.getElementById("patentName").value;
if(patentName.trim()==""){
  alert("专利名称不可为空！");
  return;
}
note=document.getElementById("note").value;
if(note!=""){
  if(len(note)>LEN200){
  alert("备注长度超过"+LEN200+"字节！");
  return;
}
}

f=document.getElementById("myform");
f.submit();
}
</script> 
   <s:head theme="xhtml"/>
</head> 
  <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  <s:form id="myform" action="patentManage_save" namespace="/admin/patent" enctype="multipart/form-data"  method="post">
  <table id="tables" width="98%" border="0" cellspacing="1" cellpadding="3" align="center">
    <tr bgcolor="6f8ac4"> 
      <td colspan="2" ><font color="#FFFFFF">专利信息录入：</font></td>
    </tr>
    <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">专利名称  ：</div></td>
      <td width="75%"><s:textfield id="patentName" name="patent.patentName" size="60" maxlength="400"/><font color="#FF0000">*</font></td>
    </tr>
    <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">受理号  ：</div></td>
      <td width="75%"><s:textfield id="acceptNo" name="patent.acceptNo" maxlength="40"/></td>
    </tr>
     <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">专利号  ：</div></td>
      <td width="75%"><s:textfield id="patentNo" name="patent.patentNo" maxlength="40"/></td>
    </tr>
    <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">专利人 ：</div></td>
      <td width="75%"><s:textfield id="patentee" name="patent.patentee" maxlength="20"/></td>
    </tr>    
    <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">申请日期：</div></td>
      <td width="75%"><input type="text" id="applyDate" name="patent.applyDate" class="Wdate" onfocus="WdatePicker()"/> </td>
    </tr>
    <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">初审合格日期：</div></td>
      <td width="75%"><input type="text" id="primaryReviewDate" name="patent.primaryReviewDate" class="Wdate" onfocus="WdatePicker()"/> </td>
    </tr>
    <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">公布及实审合格日期：</div></td>
      <td width="75%"><input type="text" id="publicDate" name="patent.publicDate" class="Wdate" onfocus="WdatePicker()"/> </td>
    </tr>
    <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">发证日期：</div></td>
      <td width="75%"><input type="text" id="certificateDate" name="patent.certificateDate" class="Wdate" onfocus="WdatePicker()"/>  </td>
    </tr> 	  
    
    <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">专利状态：</div></td>
      <td width="75%"><s:radio id="state" name="patent.state" list="#{'已申请':'已申请','已受理':'已受理','初审合格':'初审合格','实审合格及公布':'实审合格及公布','已授权':'已授权'}" value="'已申请'"/></td>
    </tr>
    <tr bgcolor="f5f5f5"> 
      <td width="25%" valign="top"> <div align="right">备注 ：</div></td>
      <td width="75%"><s:textarea id="note" name="patent.note" cols="60" rows="3"></s:textarea></td>
	</tr>
      <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">选择关联的项目：</div></td>
      <td width="75%"><div id="project"></div></td>
    </tr>
      <tr bgcolor="f5f5f5"> 
      <td width="25%"> <div align="right">专利相关图片:</div></td>
      <td width="75%"><input type="button" onclick="addPicture();" value="添加文件" /></td>
      </tr>
     
      <tr bgcolor="f5f5f5" id="last" > 
      <td width="25%"></td>
      <td width="75%"><font color="#0099FF">------------------------------------------------------------</font></td>
      </tr>
    <tr bgcolor="f5f5f5"> 
      <td colspan="2"> <div align="center"> 
          <input type="button" class="frm_btn" value=" 提 交 " onclick="check()">
          &nbsp;&nbsp;<input type="button" name="Button" value=" 返 回 " class="frm_btn" onclick="javascript:history.back()">
        </div></td>
    </tr>
  </table>
</s:form>
  </body>
</html>